package com.grass.p019lv.novel.adapter;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.dialog.BuyVipDialog;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.listener.ItemClickListener;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.base.utils.SpUtils;
import com.grass.p019lv.bean.AudioAnchorBean;

/* renamed from: com.grass.lv.novel.adapter.AudioFictionBAdapter */
public class AudioFictionBAdapter extends BaseRecyclerAdapter<AudioAnchorBean.AudioAnchorBeanData, Holder> {
    String domain;

    public void setDomain(String str) {
        this.domain = str;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((AudioAnchorBean.AudioAnchorBeanData) this.list.get(i), i);
    }

    public void onViewRecycled(Holder holder) {
        super.onViewRecycled((RecyclerView.ViewHolder) holder);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_audio_fiction_b, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.grass.lv.novel.adapter.AudioFictionBAdapter$Holder */
    public class Holder extends BaseRecyclerHolder {
        AudioFictionBbAdapter adapter;
        ImageView iv_head;
        RecyclerView recycler;
        TextView tv_more_works;
        TextView tv_name;
        TextView tv_works_num;

        public Holder(View view) {
            super(view);
            this.iv_head = (ImageView) view.findViewById(R.id.iv_head);
            this.tv_name = (TextView) view.findViewById(R.id.tv_name);
            this.tv_works_num = (TextView) view.findViewById(R.id.tv_works_num);
            this.tv_more_works = (TextView) view.findViewById(R.id.tv_more_works);
            this.recycler = (RecyclerView) view.findViewById(R.id.recycler);
        }

        public void setData(AudioAnchorBean.AudioAnchorBeanData audioAnchorBeanData, int i) {
            TextView textView = this.tv_name;
            textView.setText(audioAnchorBeanData.getAnchorName() + "");
            TextView textView2 = this.tv_works_num;
            textView2.setText("作品" + audioAnchorBeanData.getWorkNum() + "部");
            if (TextUtils.isEmpty(audioAnchorBeanData.getAnchorLogo())) {
                GlideUtils.loadResId(R.drawable.ic_logo, this.iv_head);
            } else {
                GlideUtils.loadPicHeadWh(AudioFictionBAdapter.this.domain + audioAnchorBeanData.getAnchorLogo(), this.iv_head, 600);
            }
            RecyclerView recyclerView = this.recycler;
            recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext(), 0, false));
            AudioFictionBbAdapter audioFictionBbAdapter = new AudioFictionBbAdapter();
            this.adapter = audioFictionBbAdapter;
            this.recycler.setAdapter(audioFictionBbAdapter);
            this.adapter.setDomain(AudioFictionBAdapter.this.domain);
            this.adapter.setData(audioAnchorBeanData.getFictionBaseList());
            this.adapter.setItemListener(new ItemClickListener() {
                /* class com.grass.p019lv.novel.adapter.AudioFictionBAdapter.Holder.C31341 */

                @Override // com.androidx.p013lv.base.listener.ItemClickListener
                public void onItemClick(View view, int i) {
                    if (SpUtils.getInstance().getUserInfo().getFreeWatches() != -1) {
                        new BuyVipDialog(view.getContext()).show();
                        return;
                    }
                    ARouter.getInstance().build(Constance.VOICE_NOVEL_ACTIVITY_NEW).withInt(Key.NOVEL_ID, ((AudioAnchorBean.AudioAnchorBeanData.FictionBaseListBean) Holder.this.adapter.getDataInPosition(i)).getFictionId()).navigation();
                }
            });
        }
    }
}
